package com.cgt.xiaotao.product.domain.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Collections;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageDTO<T> {
    protected Long total; // 总条数
    protected Long pages; // 总页码数
    protected List<T> list; //当前页数据

    public static <T> PageDTO<T> empty(Long total, Long pages) {
        return new PageDTO<>(total, pages, Collections.emptyList());
    }

    public static <T> PageDTO<T> of (Long total, Long pages, List<T> list) {
        return new PageDTO<>(total, pages, list);
    }

}